package com.example.demo.dao;

import com.example.demo.entity.Book;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;

public interface BookDao extends CrudRepository<Book, Integer> {
    @Modifying
    @Transactional
    @Query("update Book set book_name = :bookName where book_id = :bookId")
    void updateByBookId(@Param("bookId") int bookId ,@Param("bookName") String bookName);
}
